﻿using System;
using System.Collections.Generic;
using System.Text;
using Server.Engines.Craft;
using Server;
using Server.Items;
using Scripts.Scripts.Items.Special.Custom;

namespace Scripts.Scripts.Engines.Craft
{
    public class DefAnimalTaming : CraftSystem
    {
        public override SkillName MainSkill
        {
            get { return SkillName.AnimalTaming; }
        }
        public override string GumpTitleString
        {
            get { return "<BASEFONT COLOR=#FFFFFF><CENTER>ANIMAL TAMING MENU</CENTER></BASEFONT>"; }
        }
        private static CraftSystem m_CraftSystem;

        public static CraftSystem CraftSystem
        {
            get
            {
                if (m_CraftSystem == null)
                    m_CraftSystem = new DefAnimalTaming();

                return m_CraftSystem;
            }
        }
        public override double GetChanceAtMin(CraftItem item)
        {
            return 0.0; // 0%
        }
        public DefAnimalTaming()
            : base(1, 1, 1.25)
        {
        }
        public override int CanCraft(Mobile from, BaseTool tool, System.Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
                return 1044038; // You have worn out your tool!
            else if (!BaseTool.CheckAccessible(tool, from))
                return 1044263; // The tool must be on your person to use.

            return 0;
        }

        public override void PlayCraftEffect(Mobile from)
        {
            from.PlaySound(0x242);
        }
        public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
        {
            if (toolBroken)
                from.SendLocalizedMessage(1044038); // You have worn out your tool
            if (failed)
            {
                if (lostMaterial)
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                else
                    return 1044157; // You failed to create the item, but no materials were lost.
            }
            else
            {
                from.PlaySound(0x5AF);
                if (quality == 0)
                    return 502785; // You were barely able to make this item.  It's quality is below average.
                else if (makersMark && quality == 2)
                    return 1044156; // You create an exceptional quality item and affix your maker's mark.
                else if (quality == 2)
                    return 1044155; // You create an exceptional quality item.
                else
                    return 1044154; // You create the item.
            }
        }
        public override void InitCraftList()
        {
            int index = -1;

            index = AddCraft(typeof(CraftedSkillBall), "SkillBalls", "Basic Skill Ball", SkillName.AnimalTaming, 99.9, 110.0, typeof(BlackPearl), 0, 0, 1044361);
            //AddRes(index, typeof(Bottle), 1044529, 1, 500315);
            AddCraft(typeof(PetBondingPotion), "Potions", "Pet Bonding Potion", SkillName.AnimalTaming, 99.9, 105.0, typeof(Garlic), 0, 0, 1044361);


            MarkOption = true;
        }
    }
}
